import farmTableUtils from "@/hook/farmTableUtils";
/**
 * 用户状态：
 *
 *  import dic from './utils/dictinarys'
 * 转义 用于el-table-column 的 :formatter="dic.formatSTATE" 转义数据列表数据值
 * @param _row
 * @param _column
 * @param cellValue
 * @returns
 */
const formatSTATE = (_row: never, _column: never, cellValue: string) => {
  const dic: { [key: string]: string } = {
    "0": "禁用",
    "1": "可用",
  };
  return dic[cellValue] || "未知";
};
//:formatter="dic.formatDomain"
const formatDomain = (_row: never, _column: never, cellValue: string) => {
  const dic: { [key: string]: string } = {
    FRAME: "后台",
    APP: "业务",
  };
  return dic[cellValue] || "未知";
};

//:formatter="dic.formatType"
const formatType = (_row: never, _column: never, cellValue: string) => {
  const dic: { [key: string]: string } = {
    "1": "菜单",
    "2": "权限",
  };
  return dic[cellValue] || "未知";
};

/**
 * import dic from './utils/dictinarys'
 * 转义 用于el-table-column 的 :formatter="dic.formatSTATE" 转义数据列表数据值
 * 格式化时间
 * @param _row
 * @param _column
 * @param cellValue
 * @returns
 */
const formatTime = (_row: never, _column: never, cellValue: string) => {
  return farmTableUtils.formatDateTime(cellValue);
};
export default { formatSTATE, formatTime, formatDomain, formatType };
